Repository navigation
fix(viewer): Enter and Space press the focused control, and a redraw keeps focus - #34
Merged
Merged
Conversation
…keeps focus A page or list shortcut no longer takes a key the focused element uses itself: Enter on a button, link or summary, Space on a button, and the scroll keys in a step detail that has more to scroll. Before, Enter on a filter chip opened the selected session, Enter on a button inside an open row folded the row, and Space on a replay button started Play. A redraw that removes the focused control moves focus to the control now in its place, else to its pane or the page, instead of leaving it on the body.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In the viewer, a page or list shortcut no longer takes a key the focused control uses itself, and a redraw no longer drops keyboard focus onto the page body.
jandkstill move between steps from there.Behaviour change to know about
Clicking inside the step detail focuses it, so ↓ after a click there now scrolls the detail instead of moving to the next step (
jstill does). To undo only this, drop theSCROLL_KEYSbranch inownKey().How
ownKey(e)inindex.htmlis the one rule: the global key handler and each list's Enter/Space handler ask it first.swap()now runs throughkeepFocus(root, redraw), so every redraw that goes through the page's one DOM helper keeps focus. Three directreplaceWith/removesites use it too.Tests
test/viewer/keyboard-browser.test.ts: eight tests with real key presses (Input.dispatchKeyEvent, newpage.press()in the test driver). The existing tests dispatchKeyboardEvents from the page, which never run a key's default action, so they could not see these bugs. Each new test fails without its part of the fix.npm run buildandnpm run lintpass.npm run checkon a Mac (run before the list-row fix and the docs rewording): 6257 tests, 6244 pass, 11 skipped, 2 fail. The two failures (test/capture/hook.test.ts"concurrent hooks ... never interleave" andtest/cli/rebuild-redactions.test.ts) fail the same way on an untouchedorigin/mainin the same shell; cause not found, and this change does not touch that code.coding.sh doctoron a live install: not run (no adapter change).